gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\linear\finite\testdich.m
function [X,I,alpha,theta] = testdich( dim, datanum ) % TESTDICH randomly creates test examples for dichotomy problem. % [X,I] = testgidich( dim, datanum ) % % TESTDICH creats test data randomly for the algorithms which try % to split two finite point sets by a hyperplane (e.g. Perceptron-like % algorithms). The created data are linearly separable. % % Input: % dim [1x1] dimension of generated data. % datanum [1x1] number of generated data (size of the test set). % % Output: % X [dim x datanum] contains generated test points. % I [1 x datanum] contains labnels of test points (1 or 2). % alpha [dim x 1] a normal vector of the hyperplane which correctly % splits test data. % theta [1x1] a threshold of the hyperplane. % % See also % TESTANDR, PERCEPTR, KOZINEC, EKOZINEC, LINSVM % % Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac % (c) Czech Technical University Prague, http://cmp.felk.cvut.cz % Written Vojtech Franc (diploma thesis) % Modifications % 26-feb-2001 V.Franc X = 2*rand(dim, datanum )-1; I= zeros(1,datanum); alpha = 2*rand(dim,1)-1; theta = rand(1); I=linclass(X,alpha,0); X = X + theta/sum(alpha);